# This defines the compiler and standard ways to use it
CXX = g++
CXXFLAGS = -Wall -Wno-deprecated -m64 -O2 -DOSX -pthread 
CXXFLAGSDEBUG = -Wall -Wno-deprecated -m64 -g -pthread

# These are the sources, and computed object and header files
SRC = util.cc jobqueue.cc interpret.cc allocator.cc objects.cc economy.cc sequences.cc setval.cc objectstore.cc records.cc graphdl.cc
INC = $(addsuffix .h, $(basename $(SRC)))
OBJ = $(addsuffix .o, $(basename $(SRC)))
OBJDEBUG = $(addsuffix .debug.o, $(basename $(SRC)))

# Pattern rule making .o files from .cc
%.o : %.cc
	$(CXX) $(CXXFLAGS) -c $<

# Pattern rule making .o files from .cc
%.debug.o : %.cc
	$(CXX) $(CXXFLAGSDEBUG) -c -o $@ $<

# This is the standard command line runnable
#in: $(OBJ) in.o
#	$(CXX) $(CXXFLAGS) $(OBJ) in.o -o $@

# This is the standard command line runnable
ec: $(OBJ)
	$(CXX) $(CXXFLAGS) $(OBJ) -o $@

# This is the standard command line runnable
debug: $(OBJDEBUG)
	$(CXX) $(CXXFLAGSDEBUG) $(OBJDEBUG) -o ec.debug

Makefile: depend
-include depend

depend: $(SRC) $(INC)
	$(CXX) -MM $(CXXFLAGS) $(SRC) > depend

.PHONY: clean all
clean:
	rm -f $(OBJ) $(OBJDEBUG) in.o

all: ec debug

